The Common Intermediate Language (CIL) is a low-level human-readable programming language defined by the Common Language Infrastructure (CLI) specification. CIL is an object-oriented stack-based assembly language. Its byte code can be translated into native code or can be executed by a virtual machine.
Source code of a CLI programming language can be translated into CIL code instead of being translated into platform or processor specific object code. CIL is processor and platform independent so it can be executed in any environment supporting the Common Language Infrastructure, (e.g., Microsoft®.NET, Mono, etc.). The CIL is assembled into byte code. A CLI assembly comprising byte code and metadata can be created. When a CLI assembly is executed, the code can be just-in-time (JIT) compiled to generate native code which can be executed by the processor. As the program executes, JIT compilation converts the byte code into code that can be executed. JIT compilation can provide environment-specific optimization, runtime type safety, and assembly verification by examining the assembly metadata for illegal accesses and handling any detected violations.
Data types are described by CIL metadata. CIL metadata typically takes up a lot of space and is hierarchical in nature. The CIL metadata is translated into runtime data structures such as method tables, method descriptors, field descriptors and so on. This translation typically takes a lot of computation. Moreover, the native code generated from the CIL involves values such as field offsets, virtual table slots etc., the generation of which are also computationally expensive.